package main.demonutils.exception;

import java.util.HashMap;

import javax.swing.JOptionPane;

public enum ErrorList {
	
	RUNIO_LOAD_MAP_PARSE_ERROR ("RUNIO_LOAD_MAP"),
	RUNIO_IOEXCEPTION,
	RUNIO_LOAD_MAP_MISSING_ERROR ("RUNIO_LOAD_MAP"),
	RUNIO_SAVE_MAP_ERROR		("RUNIO_SAVE_MAP"),
	RUNIO_SAVE_MAP_BUFFER_ERROR	("RUNIO_SAVE_MAP")
	
	;
	
	private HashMap<String, String> m = new HashMap<String, String>();
	private String output;
	
	ErrorList(String... message){
		m.put("RUNIO_LOAD_MAP",
				"There are difficulties loading your map.\n");
		m.put("RUNIO_SAVE_MAP",
				"There are difficulties saving your map.\n");
		m.put("RUNIO_MOVED", 
				"Is it perhaps possible that you've moved or deleted the map file from the correct directory?\n");
		m.put("RUNIO_BAD_MAP",
				"The input doesn't conform to the expected format. Did you edit this map manually?\n");
		m.put("RUNIO_BAD_INT",
				"A string has been incorrectly parsed to int but the load can continue.\n");
		m.put("RUNIO_NEWRAN_MAP",
				"\nWe are now generating a random map for you. We hope you enjoy it and don't miss your old map too much!\n");

		output =  "We're terribly sorry, we've encountered error.";
		for(int i = 0; i<message.length; i++){
			if(m.get(message[i]) != null){
				output = output+m.get(message[i]);
			}else{
				output = output+message[i];
			}
			
		}
		output = output+"\nIf this keeps happening, contact Gabe on twitter @ReynardineFox.";
	}
	

	public void display(){
		JOptionPane.showMessageDialog(null,output);
	}
}
